<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::connection('mysql_log')->create('log_pay_cb', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('渠道支付回调');

            $table->increments('id');
            $table->integer('create_time')->comment('生成时间')->unsigned()->default(0);
            $table->integer('game_id')->comment('游戏')->unsigned()->default(0);
            $table->integer('channel')->comment('渠道')->unsigned()->default(0);
            $table->integer('game_channel_id')->comment('配置id')->unsigned()->default(0);
            $table->string('ip', 64)->comment('ip')->default('');
            $table->string('url', 2048)->comment('请求url')->default('');
            $table->string('method', 16)->comment('请求方式')->default('');
            $table->mediumText('data')->comment('请求内容');
            $table->mediumText('input_data')->comment('流数据');

            $table->index('create_time');
            $table->index('game_id');
            $table->index('channel');
            $table->index('game_channel_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mysql_log')->dropIfExists('log_pay_cb');
    }
};
